﻿/**
 * 
 * Copyright 2009, 2010 Mike Jamer [email: mikejamer@gmail.com ]
 * 
 * This File is part of Moose IRC
 * 
 * MooseIRC is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * MooseIRC is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with MooseIRC.  If not, see <http://www.gnu.org/licenses/>.
 * 
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using moose.extension;

namespace moose.irc.standard
{
    /// <summary>
    /// Raw 003 Response Action
    /// Extracts the Server Created Date Time
    /// </summary>
    [CLSCompliant(true)]
    [Response(
        Name = "moose-rsp-003",
        Description = "Handles Server Creation Date/Time",
        Author = "Mike MacKenzie-Jamer <email: mikejamer@gmail.com>",
        Version = "0.1")]
    [Trigger(TriggerText = "003")]
    public sealed class raw003Response : IrcAction
    {

        protected override IrcState valid_states()
        {
            return IrcState.Registered;
        }

        protected override void action(IrcClient client, IrcMessage input)
        {
            string message = input.ToString();
            string server_name = string.Empty;
            string server_version = string.Empty;
            int start;
            start = message.IndexOf("created ");

            client.ServerSettings[IrcServerSettings.SERVER_CREATED_DATE] = message.Substring(start);

            client.echo(message);
            return;
        }

    }
}
